﻿using MiniFox.Log;
using MiniFox.Net.Configurations;
using MiniFox.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace MiniFox.Net.Http
{
    /// <summary>
    /// 
    /// </summary>
    public class HttpAdapter : WebAdapter<HttpService>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="setting"></param>
        internal HttpAdapter(IHttpAdapterSetting setting) : base(setting)
        {
            VirtualPath = setting.VirtualPath;
        }
        /// <summary>
        /// 
        /// </summary>
        public string VirtualPath
        {
            get;
        }
        /// <summary>
        /// 
        /// </summary>
        public override string FullHost
        {
            get
            {
                return WebUtil.BuildFullUrl(SSL, Host, Port, VirtualPath, null, null, null);
            }
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="serviceSetting"></param>
        /// <returns></returns>
        protected override HttpService CreateDefaultService(IServiceSetting serviceSetting)
        {
            var service = new HttpService(serviceSetting, this);
            return service;
        }
    }
    
}
